//
//  LSZWithdrawalRecordManager.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/3/29.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZWithdrawalRecordManager.h"

@implementation LSZWithdrawalRecordManager
-(id)initWithWithdrawalRecord :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        self.arrayData = [[NSMutableArray alloc]init];
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSArray * arrayDataDic = dic[@"data"];
        NSMutableArray * arrayMutAdd = [[NSMutableArray alloc]init];
        for (NSDictionary * dicTion in arrayDataDic) {
            LSZWithdrawalRecordMg * mg = [[LSZWithdrawalRecordMg alloc]init];
            mg.amount = NullStringjudgment(NSStr(dicTion[@"amount"]));
            mg.id_id = NullStringjudgment(NSStr(dicTion[@"id"]));
            NSString * state = NullStringjudgment(NSStr(dicTion[@"status"]));
            if ([state isEqualToString:@"0"]) {
                mg.status = @"未处理";
            }  if([state isEqualToString:@"1"]){
                mg.status = @"已审核";
            }  if([state isEqualToString:@"2"]){
                mg.status = @"驳回";
            }  if([state isEqualToString:@"3"]){
                mg.status = @"已打款";
            }
            mg.uptime = NullStringjudgment(NSStr(dicTion[@"uptime"]));
            mg.trade_no = NullStringjudgment(NSStr(dicTion[@"trade_no"]));
            NSString * via =  NullStringjudgment(NSStr(dicTion[@"via"]));
            if ([via isEqualToString:@"1"]) {
                mg.via = @"微信";
                mg.title = [NSString stringWithFormat:@"提现%@元到微信",NullStringjudgment(NSStr(dicTion[@"amount"]))];
            }else if ([via isEqualToString:@"2"]){
                mg.via = @"支付宝";
                mg.title = [NSString stringWithFormat:@"提现%@元到支付宝",NullStringjudgment(NSStr(dicTion[@"amount"]))];
            }else if ([via isEqualToString:@"3"]){
                mg.via = @"手机充值";
                mg.title = [NSString stringWithFormat:@"充值话费%@元",NullStringjudgment(NSStr(dicTion[@"amount"]))];
            }
            else{
                mg.via = @"其他类型";
                mg.title = [NSString stringWithFormat:@"提现%@元",NullStringjudgment(NSStr(dicTion[@"amount"]))];
            }
            mg.pay_name = NullStringjudgment(NSStr(dicTion[@"pay_name"]));
            mg.pay_to = NullStringjudgment(NSStr(dicTion[@"pay_to"]));
            mg.real_amount = NullStringjudgment(NSStr(dicTion[@"real_amount"]));
            mg.msg = NullStringjudgment(NSStr(dicTion[@"msg"]));

            mg.appid = NullStringjudgment(NSStr(dicTion[@"via_config"][@"appid"]));
            mg.config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"config"]));
            mg.id_config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"id_config"]));
            mg.status_config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"status_config"]));
            mg.introduce = NullStringjudgment(NSStr(dicTion[@"via_config"][@"introduce"]));
            mg.is_del = NullStringjudgment(NSStr(dicTion[@"via_config"][@"is_del"]));
            mg.name = NullStringjudgment(NSStr(dicTion[@"via_config"][@"name"]));
            mg.proportion = NullStringjudgment(NSStr(dicTion[@"via_config"][@"proportion"]));
            mg.type = NullStringjudgment(NSStr(dicTion[@"via_config"][@"type"]));
            [arrayMutAdd addObject:mg];
        }
        self.arrayData = arrayMutAdd;
    }
    return self;
}
//提现成功用的
-(id)initWithDrawalSuccess :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        self.arrayData = [[NSMutableArray alloc]init];
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSDictionary * dicTion = dic[@"data"];
        NSMutableArray * arrayMutAdd = [[NSMutableArray alloc]init];
        LSZWithdrawalRecordMg * mg = [[LSZWithdrawalRecordMg alloc]init];
        mg.amount = NullStringjudgment(NSStr(dicTion[@"amount"]));
        mg.id_id = NullStringjudgment(NSStr(dicTion[@"id"]));
        NSString * state = NullStringjudgment(NSStr(dicTion[@"status"]));
        if ([state isEqualToString:@"0"]) {
            mg.status = @"未处理";
        }  if([state isEqualToString:@"1"]){
            mg.status = @"已审核";
        }  if([state isEqualToString:@"2"]){
            mg.status = @"驳回";
        }  if([state isEqualToString:@"3"]){
            mg.status = @"已打款";
        }
        mg.uptime = NullStringjudgment(NSStr(dicTion[@"uptime"]));
        mg.trade_no = NullStringjudgment(NSStr(dicTion[@"trade_no"]));
        NSString * via =  NullStringjudgment(NSStr(dicTion[@"via"]));
        if ([via isEqualToString:@"1"]) {
            mg.via = @"微信";
            mg.title = [NSString stringWithFormat:@"提现%@元到微信",NullStringjudgment(NSStr(dicTion[@"amount"]))];
        }else if ([via isEqualToString:@"2"]){
            mg.via = @"支付宝";
            mg.title = [NSString stringWithFormat:@"提现%@元到支付宝",NullStringjudgment(NSStr(dicTion[@"amount"]))];
        }else if ([via isEqualToString:@"3"]){
            mg.via = @"手机充值";
            mg.title = [NSString stringWithFormat:@"充值话费%@元",NullStringjudgment(NSStr(dicTion[@"amount"]))];
        }
        else{
            mg.via = @"其他类型";
            mg.title = [NSString stringWithFormat:@"提现%@元",NullStringjudgment(NSStr(dicTion[@"amount"]))];
        }
        mg.pay_name = NullStringjudgment(NSStr(dicTion[@"pay_name"]));
        mg.pay_to = NullStringjudgment(NSStr(dicTion[@"pay_to"]));
        mg.real_amount = NullStringjudgment(NSStr(dicTion[@"real_amount"]));
        mg.msg = NullStringjudgment(NSStr(dicTion[@"msg"]));

        mg.appid = NullStringjudgment(NSStr(dicTion[@"via_config"][@"appid"]));
        mg.config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"config"]));
        mg.id_config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"id_config"]));
        mg.status_config = NullStringjudgment(NSStr(dicTion[@"via_config"][@"status_config"]));
        mg.introduce = NullStringjudgment(NSStr(dicTion[@"via_config"][@"introduce"]));
        mg.is_del = NullStringjudgment(NSStr(dicTion[@"via_config"][@"is_del"]));
        mg.name = NullStringjudgment(NSStr(dicTion[@"via_config"][@"name"]));
        mg.proportion = NullStringjudgment(NSStr(dicTion[@"via_config"][@"proportion"]));
        mg.type = NullStringjudgment(NSStr(dicTion[@"via_config"][@"type"]));
        [arrayMutAdd addObject:mg];
        self.arrayData = arrayMutAdd;
    }
    return self;
}
@end
@implementation  LSZWithdrawalRecordMg
@end
